/***********************************************************************
 * Module:  EvenementIhmImp.java
 * Author:  29004847
 * Purpose: Defines the Class EvenementIhmImp
 ***********************************************************************/

package invoker;

import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JMenuBar;
import javax.swing.JMenu;

import java.awt.Cursor;

import javax.swing.JMenuItem;
import javax.swing.KeyStroke;

import java.awt.event.KeyEvent;
import java.awt.event.InputEvent;

import javax.swing.JSeparator;
import javax.swing.JList;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.SwingConstants;

import java.awt.Font;

import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JButton;

import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.SystemColor;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;


public class EvenementIhmImp extends JFrame {

	private JMenuBar menuBar_;
	private JMenu fichier_;
	private JMenu aPropos_;
	private JPanel conteneur_ = new JPanel();
	private JMenuItem newEvent_;
	private JMenuItem aide_;
	private JMenuItem quitter_;
	private JTextField jtxtNomEvenement_;
	private JTextField jTxtNomCircuit_;
	private JTextField jtxtLongueurCircuit_;
	private JLabel lblEnMtre;
	private JList listCourses_;
	private JList listVoitures_;
	private JLabel lblListeDesCourses_;
	private JLabel lblListeDesVoitures_;
	private JButton btnModifierLaCourse_;
	private JButton btnSupprimerLaCourse;
	private JButton btnCrerUneVoiture_;
	private JButton btnModifierLaVoiture_;
	private JButton btnSupprimerLaVoiture_;
	private JButton btnSauvegarder_;
	private JButton btnImprimer_;
	private JTable table;
	private JFileChooser fc;

	public EvenementIhmImp() {
		this.setResizable(false);
		this.setTitle("Chronomètre");
		this.setSize(900, 600);

		menuBar_ = new JMenuBar();
		menuBar_.setToolTipText("");
		menuBar_.setFont(new Font("Times New Roman", Font.BOLD, 12));
		setJMenuBar(menuBar_);

		fichier_ = new JMenu("Fichier");
		fichier_.setHorizontalTextPosition(SwingConstants.LEFT);
		fichier_.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		menuBar_.add(fichier_);


		newEvent_ = new JMenuItem("Nouvel évènement");
		newEvent_.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK));
		fichier_.add(newEvent_);

		fichier_.addSeparator();

		quitter_ = new JMenuItem("Quitter");
		quitter_.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_MASK));
		fichier_.add(quitter_);

		aPropos_ = new JMenu("A propos");
		menuBar_.add(aPropos_);

		aide_ = new JMenuItem("? Aide");
		aide_.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
		aPropos_.add(aide_);

		this.setContentPane(conteneur_);
		
		JLabel lblEditEvent = new JLabel("EDIT EVENT");
		
		JLabel lblNomDeLvnement = new JLabel("Nom de l'évènement");
		
		jtxtNomEvenement_ = new JTextField();
		jtxtNomEvenement_.setText("Nom de l'évènement");
		jtxtNomEvenement_.setColumns(10);
		
		JLabel lblNomDuCircuit = new JLabel("Nom du circuit");
		
		jTxtNomCircuit_ = new JTextField();
		jTxtNomCircuit_.setText("Nom du circuit");
		jTxtNomCircuit_.setColumns(10);
		
		JLabel lblLongueurCircuit_ = new JLabel("Longueur du circuit");
		
		jtxtLongueurCircuit_ = new JTextField();
		jtxtLongueurCircuit_.setText("Longueur du circuit");
		jtxtLongueurCircuit_.setColumns(10);
		
		lblEnMtre = new JLabel("en mètre");
		
		listCourses_ = new JList();
		listCourses_.setBackground(SystemColor.activeCaptionBorder);
		listCourses_.setSelectionBackground(SystemColor.controlShadow);
		
		listVoitures_ = new JList();
		listVoitures_.setBackground(SystemColor.activeCaptionBorder);
		listVoitures_.setSelectionBackground(SystemColor.controlShadow);
		
		lblListeDesCourses_ = new JLabel("Liste des courses");
		
		lblListeDesVoitures_ = new JLabel("Liste des courses");
		
		JButton btnCrerUneCourse_ = new JButton("Créer une course");
		
		btnModifierLaCourse_ = new JButton("Modifier la course");
		
		btnSupprimerLaCourse = new JButton("Supprimer la course");
		
		btnCrerUneVoiture_ = new JButton("Créer une voiture");
		
		btnModifierLaVoiture_ = new JButton("Modifier la voiture");
		
		btnSupprimerLaVoiture_ = new JButton("Supprimer la voiture");
		
		btnSauvegarder_ = new JButton("Sauvegarder");
		btnSauvegarder_.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});
		
		btnImprimer_ = new JButton("Imprimer");
		
		table = new JTable();
		GroupLayout gl_conteneur_ = new GroupLayout(conteneur_);
		gl_conteneur_.setHorizontalGroup(
			gl_conteneur_.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_conteneur_.createSequentialGroup()
					.addGap(419)
					.addComponent(lblEditEvent, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
					.addGap(418))
				.addGroup(gl_conteneur_.createSequentialGroup()
					.addGroup(gl_conteneur_.createParallelGroup(Alignment.TRAILING, false)
						.addGroup(gl_conteneur_.createSequentialGroup()
							.addGap(57)
							.addGroup(gl_conteneur_.createParallelGroup(Alignment.LEADING)
								.addGroup(gl_conteneur_.createSequentialGroup()
									.addGroup(gl_conteneur_.createParallelGroup(Alignment.LEADING)
										.addComponent(listCourses_, GroupLayout.DEFAULT_SIZE, 310, Short.MAX_VALUE)
										.addGroup(gl_conteneur_.createParallelGroup(Alignment.TRAILING, false)
											.addComponent(btnSupprimerLaCourse, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)
											.addComponent(btnModifierLaCourse_, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
											.addComponent(btnCrerUneCourse_, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 160, GroupLayout.PREFERRED_SIZE))
										.addComponent(btnSauvegarder_, Alignment.TRAILING))
									.addPreferredGap(ComponentPlacement.RELATED, 160, Short.MAX_VALUE))
								.addGroup(gl_conteneur_.createSequentialGroup()
									.addComponent(lblListeDesCourses_)
									.addPreferredGap(ComponentPlacement.RELATED)))
							.addGroup(gl_conteneur_.createParallelGroup(Alignment.LEADING)
								.addComponent(btnImprimer_, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)
								.addComponent(lblListeDesVoitures_, GroupLayout.DEFAULT_SIZE, 310, Short.MAX_VALUE)
								.addComponent(listVoitures_, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 310, Short.MAX_VALUE)
								.addGroup(Alignment.TRAILING, gl_conteneur_.createSequentialGroup()
									.addPreferredGap(ComponentPlacement.RELATED)
									.addGroup(gl_conteneur_.createParallelGroup(Alignment.LEADING, false)
										.addComponent(btnSupprimerLaVoiture_, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
										.addComponent(btnModifierLaVoiture_, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
										.addComponent(btnCrerUneVoiture_, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 154, Short.MAX_VALUE)))))
						.addGroup(gl_conteneur_.createSequentialGroup()
							.addGroup(gl_conteneur_.createParallelGroup(Alignment.TRAILING)
								.addComponent(lblNomDuCircuit, GroupLayout.PREFERRED_SIZE, 83, GroupLayout.PREFERRED_SIZE)
								.addComponent(lblNomDeLvnement))
							.addGap(18)
							.addGroup(gl_conteneur_.createParallelGroup(Alignment.LEADING, false)
								.addComponent(jtxtNomEvenement_, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 657, GroupLayout.PREFERRED_SIZE)
								.addGroup(gl_conteneur_.createSequentialGroup()
									.addGroup(gl_conteneur_.createParallelGroup(Alignment.TRAILING)
										.addComponent(table, GroupLayout.PREFERRED_SIZE, 1, GroupLayout.PREFERRED_SIZE)
										.addComponent(jTxtNomCircuit_, GroupLayout.PREFERRED_SIZE, 245, GroupLayout.PREFERRED_SIZE))
									.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
									.addComponent(lblLongueurCircuit_, GroupLayout.PREFERRED_SIZE, 124, GroupLayout.PREFERRED_SIZE)
									.addGap(18)
									.addComponent(jtxtLongueurCircuit_, GroupLayout.PREFERRED_SIZE, 177, GroupLayout.PREFERRED_SIZE)
									.addGap(18)
									.addComponent(lblEnMtre)))))
					.addContainerGap(57, Short.MAX_VALUE))
		);
		gl_conteneur_.setVerticalGroup(
			gl_conteneur_.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_conteneur_.createSequentialGroup()
					.addContainerGap()
					.addComponent(lblEditEvent)
					.addGap(11)
					.addGroup(gl_conteneur_.createParallelGroup(Alignment.BASELINE)
						.addComponent(jtxtNomEvenement_, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblNomDeLvnement, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE))
					.addGap(18)
					.addGroup(gl_conteneur_.createParallelGroup(Alignment.BASELINE)
						.addComponent(jTxtNomCircuit_, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(jtxtLongueurCircuit_, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblLongueurCircuit_)
						.addComponent(lblEnMtre)
						.addComponent(lblNomDuCircuit))
					.addGroup(gl_conteneur_.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_conteneur_.createSequentialGroup()
							.addGap(30)
							.addGroup(gl_conteneur_.createParallelGroup(Alignment.TRAILING)
								.addComponent(lblListeDesCourses_, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE)
								.addComponent(lblListeDesVoitures_))
							.addPreferredGap(ComponentPlacement.RELATED)
							.addGroup(gl_conteneur_.createParallelGroup(Alignment.BASELINE)
								.addComponent(listCourses_, GroupLayout.PREFERRED_SIZE, 213, GroupLayout.PREFERRED_SIZE)
								.addComponent(listVoitures_, GroupLayout.PREFERRED_SIZE, 213, GroupLayout.PREFERRED_SIZE))
							.addGap(18)
							.addGroup(gl_conteneur_.createParallelGroup(Alignment.BASELINE)
								.addComponent(btnCrerUneCourse_)
								.addComponent(btnCrerUneVoiture_))
							.addPreferredGap(ComponentPlacement.RELATED)
							.addGroup(gl_conteneur_.createParallelGroup(Alignment.TRAILING)
								.addComponent(btnModifierLaCourse_)
								.addComponent(btnModifierLaVoiture_))
							.addPreferredGap(ComponentPlacement.RELATED)
							.addGroup(gl_conteneur_.createParallelGroup(Alignment.TRAILING)
								.addComponent(btnSupprimerLaCourse)
								.addComponent(btnSupprimerLaVoiture_))
							.addPreferredGap(ComponentPlacement.UNRELATED)
							.addGroup(gl_conteneur_.createParallelGroup(Alignment.BASELINE)
								.addComponent(btnImprimer_)
								.addComponent(btnSauvegarder_)))
						.addGroup(gl_conteneur_.createSequentialGroup()
							.addGap(143)
							.addComponent(table, GroupLayout.PREFERRED_SIZE, 1, GroupLayout.PREFERRED_SIZE)))
					.addContainerGap(19, Short.MAX_VALUE))
		);
		conteneur_.setLayout(gl_conteneur_);
		
	}
}